package com.xxl.job.executor.feign;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClientBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class DynamicFeignClient {
    FeignClientBuilder feignClientBuilder;

    public DynamicFeignClient(@Autowired ApplicationContext appContext) {
        this.feignClientBuilder = new FeignClientBuilder(appContext);
    }

    public DispatchFeignClient getFeignClient(String seviceName) {
        return this.feignClientBuilder.forType(DispatchFeignClient.class, seviceName).build();
    }

}